package edu.njust.pojo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ComputerRoom {
    private String id;
    private Integer num;
    private Integer remain_num;
    private Integer usable;

    public ComputerRoom(String id, Integer num,Integer usable) {
        this.id = id;
        this.num = num;
        this.remain_num = num;
        this.usable = usable;
    }


    public Integer getNum() {
        if (this.remain_num==null)
            this.remain_num=this.num;
        return num;
    }

    public boolean schedule(Integer student_num){
        if(student_num>remain_num){
            return false;
        }
        remain_num -= student_num;
        return true;
    }

    public Integer changeUsable(Integer change_num){
        if(change_num+usable>num || change_num+usable<0){
            return 0;
        }
        usable = change_num+usable;
        return 1;
    }
}
